package com.damai.http;

import java.util.HashMap;
import java.util.Map;

import com.citywithincity.api.ApiBuildConfig;

public class AbsRequest implements Request {
	public static int READ_TIMEOUT = 24000;
	public static int CONNECT_TIMEOUT = 12000;
	
	private String method;
	private byte[] body;
	private Map<String, String> header;
	private String url;
	private String encoding;
	
	private int chunkStreamMode;
	
	private int readTimeout = READ_TIMEOUT;
	private int connectTimeout = CONNECT_TIMEOUT;
	
	
	
	
	public String getMethod() {
		return method;
	}
	public void setMethod(String method) {
		this.method = method;
	}
	public byte[] getBody() {
		return body;
	}
	public void setBody(byte[] body) {
		this.body = body;
	}
	public Map<String, String> getHeader() {
		return header;
	}
	public void setHeader(Map<String, String> header) {
		this.header = header;
	}
	@Override
	public void setHeader(String key, String value) {
		if(header==null){
			header = new HashMap<String, String>();
		}
		header.put(key, value);
	}
	@Override
	public void setUrl(String url) {
		this.url = url;
	}
	@Override
	public String getUrl() {
		return url;
	}
	@Override
	public void setEncoding(String encoding) {
		this.encoding = encoding;
	}
	@Override
	public String getEncoding() {
		
		return encoding == null ? ApiBuildConfig.DEFAULT_ENCODING : encoding;
	}
	@Override
	public void setReadTimeout(int readTimeout) {
		this.readTimeout = readTimeout;
	}
	@Override
	public int getReadTimeout() {
		return readTimeout;
	}
	@Override
	public void setConnectTimeout(int connectTimeout) {
		this.connectTimeout = connectTimeout;
	}
	@Override
	public int getConnectTimeout() {
		return connectTimeout;
	}
	public int getChunkStreamMode() {
		return chunkStreamMode;
	}
	public void setChunkStreamMode(int chunkStreamMode) {
		this.chunkStreamMode = chunkStreamMode;
	}

}
